<?php

class System_Model_Test extends Asd_Model
{
    public function __construct($id = null) {
        parent::__construct(new System_Model_DbTable_Test(), $id);
    }
    
    public function getTests($array = array()) {
        $select = $this->_dbTable->select();
        if (is_array($array)){
            if (isset($array['problem_id'])){
                $select->where('problem_id = ?', $array['problem_id']);
            }
            if (isset($array['test_limit']) && $array['test_limit'] != null){
                $select->limit(intval($array['test_limit']));
            }
        }
        $select->order('test_id');
        return $this->_dbTable->fetchAll($select);
    }
}

